/**
 * "Visual Paradigm: DO NOT MODIFY THIS FILE!"
 * 
 * This is an automatic generated file. It will be regenerated every time 
 * you generate persistence class.
 * 
 * Modifying its content may cause the program not work, or your work may lost.
 */

/**
 * Licensee: Faculty of informatics, Burapha University 01
 * License Type: Purchased
 */
package cn.imvc.app.entities;

import java.io.Serializable;
import javax.persistence.*;
@Entity
@org.hibernate.annotations.Proxy(lazy=false)
@Table(name="inventory_flow")
public class InventoryFlow implements Serializable {
	public InventoryFlow() {
	}
	
	private int id;
	
	private cn.imvc.app.entities.Goods goods;
	
	private cn.imvc.app.entities.GoodsSku goodsSku;
	
	private Byte direction;
	
	private Integer count;
	
	private String remark;
	
	private Integer userId;
	
	private java.util.Date createdAt;
	
	private Integer afterChange;
	
	private cn.imvc.app.entities.GoodsOrder goodsOrder;
	
	public void setId(int value) {
		this.id = value;
	}
	
	@Column(name="id", nullable=false)	
	@Id	
	@GeneratedValue(generator="CN_IMVC_APP_ENTITIES_INVENTORYFLOW_ID_GENERATOR")	
	@org.hibernate.annotations.GenericGenerator(name="CN_IMVC_APP_ENTITIES_INVENTORYFLOW_ID_GENERATOR", strategy="identity")	
	public int getId() {
		return id;
	}
	
	@Transient	
	public int getORMID() {
		return getId();
	}
	
	public void setDirection(byte value) {
		setDirection(new Byte(value));
	}
	
	public void setDirection(Byte value) {
		this.direction = value;
	}
	
	@Column(name="direction", nullable=true)	
	public Byte getDirection() {
		return direction;
	}
	
	public void setCount(int value) {
		setCount(new Integer(value));
	}
	
	public void setCount(Integer value) {
		this.count = value;
	}
	
	@Column(name="count", nullable=true, length=10)	
	public Integer getCount() {
		return count;
	}
	
	public void setRemark(String value) {
		this.remark = value;
	}
	
	@Column(name="remark", nullable=true, length=255)	
	public String getRemark() {
		return remark;
	}
	
	public void setUserId(int value) {
		setUserId(new Integer(value));
	}
	
	public void setUserId(Integer value) {
		this.userId = value;
	}
	
	@Column(name="userId", nullable=true, length=10)	
	public Integer getUserId() {
		return userId;
	}
	
	public void setCreatedAt(java.util.Date value) {
		this.createdAt = value;
	}
	
	@Column(name="createdAt", nullable=true)	
	@Temporal(TemporalType.TIMESTAMP)	
	public java.util.Date getCreatedAt() {
		return createdAt;
	}
	
	public void setAfterChange(int value) {
		setAfterChange(new Integer(value));
	}
	
	public void setAfterChange(Integer value) {
		this.afterChange = value;
	}
	
	@Column(name="afterChange", nullable=true, length=10)	
	public Integer getAfterChange() {
		return afterChange;
	}
	
	public void setGoods(cn.imvc.app.entities.Goods value) {
		this.goods = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.Goods.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.Goods getGoods() {
		return goods;
	}
	
	public void setGoodsSku(cn.imvc.app.entities.GoodsSku value) {
		this.goodsSku = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.GoodsSku.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsSkuId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsSku getGoodsSku() {
		return goodsSku;
	}
	
	public void setGoodsOrder(cn.imvc.app.entities.GoodsOrder value) {
		this.goodsOrder = value;
	}
	
	@ManyToOne(targetEntity=cn.imvc.app.entities.GoodsOrder.class, fetch=FetchType.LAZY)	
	@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.LOCK})	
	@JoinColumns({ @JoinColumn(name="goodsOrderId", referencedColumnName="id", nullable=false) })	
	@org.hibernate.annotations.LazyToOne(value=org.hibernate.annotations.LazyToOneOption.NO_PROXY)	
	public cn.imvc.app.entities.GoodsOrder getGoodsOrder() {
		return goodsOrder;
	}
	
	public String toString() {
		return toString(false);
	}
	
	public String toString(boolean idOnly) {
		if (idOnly) {
			return String.valueOf(getId());
		}
		else {
			StringBuffer sb = new StringBuffer();
			sb.append("InventoryFlow[ ");
			sb.append("Id=").append(getId()).append(" ");
			if (getGoods() != null)
				sb.append("Goods.Persist_ID=").append(getGoods().toString(true)).append(" ");
			else
				sb.append("Goods=null ");
			if (getGoodsSku() != null)
				sb.append("GoodsSku.Persist_ID=").append(getGoodsSku().toString(true)).append(" ");
			else
				sb.append("GoodsSku=null ");
			sb.append("Direction=").append(getDirection()).append(" ");
			sb.append("Count=").append(getCount()).append(" ");
			sb.append("Remark=").append(getRemark()).append(" ");
			sb.append("UserId=").append(getUserId()).append(" ");
			sb.append("CreatedAt=").append(getCreatedAt()).append(" ");
			sb.append("AfterChange=").append(getAfterChange()).append(" ");
			if (getGoodsOrder() != null)
				sb.append("GoodsOrder.Persist_ID=").append(getGoodsOrder().toString(true)).append(" ");
			else
				sb.append("GoodsOrder=null ");
			sb.append("]");
			return sb.toString();
		}
	}
	
}
